Skip to content

docs(patterns): URL contract accuracy fixes from fn-182.5 codex review - #4

Merged
acebytes merged 2 commits into
mainfrom
patterns-url-contract-accuracy
Aug 14, 2026
Merged

docs(patterns): URL contract accuracy fixes from fn-182.5 codex review#4
acebytes merged 2 commits into
mainfrom
patterns-url-contract-accuracy

Conversation

@acebytes

Copy link
Copy Markdown
Contributor

What

Two teaching-accuracy fixes in reference/patterns.md §24 (Guarded URL parsing), flagged by the codex impl review of AppOS-Desktop task fn-182.5 (bundled factory-context regen):

  1. Double-encode claim corrected (Major): the pinned-divergences bullet claimed pre-encoded query values double-encode on an href round-trip (%3A%253A). That divergence reproduces on Foundation's URLComponents.queryItems construction path — NOT on the plain URL(string:) parse → absoluteString path the injected URL global uses. Desktop's own merged test (JSCURLCoherenceTests.testPreEncodedQueryRoundTripComputedRow, PR #140) pins verbatim %3A preservation. Teaching the false divergence could prompt generated plugins into harmful compensating encoding. Replaced with an explicit "queryItems-only" correction note.

  2. TypeError contract qualified (Minor): "throws on scheme-less or unparseable input" now reads: throws on unparseable input, and on scheme-less/scheme-relative input lacking a valid absolute base (new URL('/api', 'https://x.test') resolves); a bad base throws first. The old wording contradicted the documented new URL(url, base?) resolution contract.

Plus small byte-ceiling trims within §24 (parse-coherence bullet, guard comment, intro) so the compiled factory context stays under the 175 KB fn-56 ceiling: 179,175 B (25 B headroom; it was 13 B pre-change).

Regen + gates

  • compile-factory-context.sh regen included (compiled/plugin-factory-context.md + compiled/manifest.json); --check green in both repos
  • npm run check green: SDK mirror freshness + verify-knowledge (69 fences) + compiled freshness

Coordination

…l review

- Drop the %3A -> %253A href round-trip double-encode claim from the
  pinned-divergences bullet: it reproduces on Foundation's
  URLComponents.queryItems construction path, NOT the plain URL(string:)
  parse -> absoluteString path the injected global uses (Desktop's
  JSCURLCoherenceTests.testPreEncodedQueryRoundTripComputedRow pins
  verbatim %3A preservation). Replaced with an explicit
  queryItems-only correction note.
- Qualify the TypeError contract: scheme-less/scheme-relative input
  throws only WITHOUT a valid absolute base (new URL('/api', base)
  resolves); a bad base throws first.
- Byte-ceiling trims within §24 (parse-coherence bullet, guard comment,
  intro) keep the compiled factory context at 179175 B under the 175 KB
  fn-56 ceiling; regen via compile-factory-context.sh; npm run check
  green (freshness + verify-knowledge + compiled freshness)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant